package com.wyz.tracing.domain.service.tracing;

import com.wyz.tracing.domain.entity.base.Aggregate;
import com.wyz.tracing.domain.entity.base.Identifier;
import com.wyz.tracing.domain.entity.tracing.different.AggregateDifference;

import java.io.IOException;

/**
 * @author wyz
 * @version 1.0
 * @date 2023/8/15
 */
public interface AggregateTracingManager<T extends Aggregate<ID>, ID extends Identifier> {

    /**
     * 开始追踪
     *
     * @param aggregate
     */
    void attach(T aggregate) throws IOException, ClassNotFoundException;

    /**
     * 解除追踪
     *
     * @param aggregate
     */
    void detach(T aggregate);

    /**
     * 对比差异
     *
     * @param aggregate
     * @return
     */
    AggregateDifference<T, ID> different(T aggregate) throws IllegalAccessException;

    /**
     * 合并变更
     *
     * @param aggregate
     */
    void merge(T aggregate) throws IOException, ClassNotFoundException;
}
